package edu.uts.reekie.designer.implementation;

import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.gef.ui.actions.GEFActionConstants;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;

import edu.uts.reekie.designer.AbstractContextMenuProvider;
import edu.uts.reekie.designer.actions.SetConnectorDirectionAction;

import edu.uts.reekie.designer.implementation.actions.*;

public class ContextMenuProvider extends AbstractContextMenuProvider {

	public ContextMenuProvider(EditPartViewer viewer, ActionRegistry registry) {
		super(viewer, registry);
	}

	protected void addToContextMenu(IMenuManager manager) {
		IAction action = null;
		
		// add the connector styles
		for (String setConnDec: SetConnectorStyleAction.getAllIds()){
			action = getActionRegistry().getAction(setConnDec);
			if (action!=null && action.isEnabled())
				manager.appendToGroup(GEFActionConstants.GROUP_REST, action);	
		}
		
		for (String setConnDec: ChangeConnectorHasPortAction.getAllIds()){
			action = getActionRegistry().getAction(setConnDec);
			if (action!=null && action.isEnabled())
				manager.appendToGroup(GEFActionConstants.GROUP_REST, action);	
		}
	
		
	}

}
